home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1993-08-16 | 7.2 KB | 173 lines |
- (*---------------------------------------------------------------------------
- :Program. IFFLoad.mod
- :Author. Fridtjof Siebert
- :Address. Nobileweg 67, D-7-Stgt-40
- :Phone. 0711/822509
- :Shortcut. [fbs]
- :Version. .01
- :Date. 19-May-88
- :Copyright. PD
- :Language. Modula-II
- :Translator. M2Amiga
- :Imports. none.
- :UpDate. none.
- :Contents. Ladeprocedure für ILBM (IFF)-Bilder.
- ---------------------------------------------------------------------------*)
- DEFINITION MODULE IFFLoad;
-
- FROM Intuition IMPORT ScreenPtr,NewScreen,WindowPtr,NewWindow;
- FROM Exec IMPORT UByte;
-
- (*--------------------------- Types: ------------------------------------*)
-
- TYPE
- IFFTitles = (BMHD,CMAP,GRAB,DEST,CAMG,CRNG,BODY,SPRT,CCRT,CMHD,DPPV);
- IFFTitleSet = SET OF IFFTitles;
- (* SPRT,CCRT,CMHD,DPPV not implemented !!! *)
-
- ViewTypes = (vt0,Ersy,Lace,LPen,vt4,vt5,vt6,vt7,Gaud,Color,DblPF,HoMod,
- vt12,vt13,vt14,Hires,v16);
- ViewTypeSet = SET OF ViewTypes;
- (* which ViewModes are selected *)
-
- TYPE
-
- (*------------- The Structure that keeps all the data: ------------------*)
- (* You don't have to understand all variables in this structure! Only some *)
- (* are important, like BMHD.width/height or CMAP.red[] etc. The other data *)
- (* is used by the Routines that are exported from this module,like DoCycle *)
- (* etc. *)
-
- IFFInfoTypePtr = POINTER TO IFFInfoType;
- IFFInfoType = RECORD
- (* This contains all Data needed for a Picture *)
-
- (*------ Which Data is availble: ------*)
- IFFTitle: IFFTitleSet; (* all Sub-Records, whose equally named Flag*)
- (* is set here, contain readable data *)
-
- (*------ Information on BitMap: ------*)
- BMHD: RECORD
-
- width,height: INTEGER; (* the Picture's Size *)
- depth: UByte; (* it's Depth (how many BitPlanes) *)
- left,top: INTEGER; (* it's Location *)
- masking: UByte; (* Masking (see Documentation) *)
- transCol: INTEGER; (* Transparent Color *)
- xAspect,yAspect: UByte; (* Verzerrung *)
- scrnWidth,scrnHeight: INTEGER; (* The Image's Screen's Size *)
- END;
-
- (*------ Information on Colors: ------*)
- CMAP: RECORD
-
- colorCnt: CARDINAL; (* Number of Colors used *)
- red,green,blue: ARRAY[0..63] OF UByte;
- (* the Colors (I hope for 6 Bitplanes to be possible anytime) *)
- END;
-
- (*------ Information on HotSpot: ------*)
- GRAB: RECORD
-
- hotX,hotY: INTEGER; (* Hot-Spot of this Image (if exists *)
- END;
-
- (*------ Information on Destination-Bitmap: ------*)
- DEST: RECORD
- depth: UByte; (* number of Planes *)
- planePick: CARDINAL;
- planeOnOff: CARDINAL; (* set or clear other Planes ? *)
- planeMask: CARDINAL; (* planes to be changed *)
- END;
-
- (*------ Information on any Special ViewMode: ------*)
- CAMG: RECORD
- viewType: ViewTypeSet; (* ViewMode *)
- END;
-
- (*------ Information on ColorCycling: ------*)
- CRNG: RECORD
- count: CARDINAL; (* Number of ColorCyclings *)
- data: ARRAY[0..15] OF RECORD
-
- rate: INTEGER; (* velocity, 800H is 60 per second *)
- on: BOOLEAN; (* decide, wether CRNG is active or not *)
- forward: BOOLEAN; (* Direction (DPaint) *)
- low,high: UByte; (* lower and upper Color of this Range *)
- END;
- END;
- (*------ Internal Information: ------*)
- Internal: RECORD
- CycleID: CARDINAL; (* that's to distinguish different cyclings *)
- END;
- END;
-
- (* That's been quite a complex Variable. If you wanna use it, do it this *)
- (* way: *)
- (* e.g. You wanna know, how Deep your Image is. Ça marche comme ça: *)
- (* MyDepth := IFFInfo.BMHD.depth; *)
- (* You can get the speed of the second Colorcycle this way: *)
- (* speed := IFFInfo.CRNG.data[2].rate; *)
-
- (*-------------- That's the Variable, that contains all Data ------------*)
- (* this should be imported to your Module to get the Data. Don't forget to *)
- (* save the data, e.g. to a variable of the same type. Everytime you load *)
- (* a new IFF-File, the data is scratched !!! (i.e. the new data is written *)
- (* into this structure.) *)
-
- VAR
- IFFInfo: IFFInfoType;
-
- (*-------------------- The NewScreen-Structure. -------------------------*)
- (* this can be used to open the Screen, if dontopen is specified *)
-
- VAR
- NuScreen: NewScreen;
-
- (*-------------------- The NewWindow-Structure. -------------------------*)
- (* this can be used to open the Window later. Don't forget to put Screen- *)
- (* Ptr in NuWindow.screen !!! *)
-
- VAR
- NuWindow: NewWindow;
-
- (*----------------- That's the Procedure: -------------------------------*)
-
- TYPE
- ReadILBMFlags = (front,visible,dontopen,window);
- ReadILBMFlagSet = SET OF ReadILBMFlags;
-
- PROCEDURE ReadILBM(name: ARRAY OF CHAR; Flags: ReadILBMFlagSet;
- VAR Screen: ScreenPtr; VAR Window: WindowPtr): BOOLEAN;
- (* ReadILBM() lädt ein IFF-Bild und öffnet das geladene Bild als Screen. *)
- (* Name: The IFF-Filename *)
- (* Flags: *)
- (* -front: decides whether Screen is first or last one while loading *)
- (* -visible: decides if display should be turned off (that's faster) *)
- (* -dontopen: avoids to open the Screen. The Returned value is NIL *)
- (* -window: if set, an Window of the same size as the Image is opened. *)
- (* So, Gadgets etc. can be added to it. *)
- (* Screen: Pointer to Screen-structure of opened Screen *)
- (* Window: Pointer to the opened Window or NIL if window isn't set. *)
- (* Result: FALSE if error occured. Then there's no Screen opened. *)
-
- (*--------------------- Colorcycling: -----------------------------------*)
-
- PROCEDURE DoCycle(Info: IFFInfoTypePtr; Screen: ScreenPtr): BOOLEAN;
- (* this should create an interrupt, that does cycling. You needn't worry, *)
- (* whether ther's cycling data or not. Don't forget to call EndCycle to *)
- (* remove the Cycling-Interrupt !!! *)
- (* if result is false, any error occured. Don't call EndCycle in this case!*)
-
- PROCEDURE EndCycle(Info: IFFInfoTypePtr);
- (* remove cycling-Interrupt *)
-
- (*
- PROCEDURE WriteILBM(name: ARRAY OF CHAR; Scrn: ScreenPtr; GrabX,GrabY:
- INTEGER; Cycle,Dest,: BOOLEAN; SpecialView: ViewTypeSet)
- : BOOLEAN;
- (* that's only a dream for a future version *)
- *)
-
- END IFFLoad.
-